package homework1;

import java.util.Random;
import java.util.Scanner;

public class DoubleDimensionalArray {
public static void main (String[] args) {
	Random a = new Random();
	Scanner sc = new Scanner(System.in);
	System.out.println("请输入数组宽度");
	int w =sc.nextInt();
	System.out.println("请输入数组长度");
	int h =sc.nextInt();
	int [][]arr = new int[w][h];
	for(int i=0;i<w;i++)
	{
		for(int j=0;j<h;j++) 
		{
			arr[i][j]=a.nextInt(101);
			System.out.print(arr[i][j]+" ");
		}
		System.out.println();
	}
	int[] wmaxlocat =new int[w];
	int wmax=0;
	boolean x =true;
	for(int i=0;i<w;i++)
	{
		for(int j=0;j<h;j++)
		{
			if(arr[i][j]>wmax)
			{
				wmax=arr[i][j];
				wmaxlocat[i]=j;
			}
		}
	}
	for(int i=0;i<w;i++)
	{
		x=true;
		for(int j=0;j<w;j++)
		{
			if(arr[i][wmaxlocat[i]]<arr[j][wmaxlocat[i]])
	        x=false;
		}
		if(x==true)
			System.out.println(arr[i][wmaxlocat[i]]);
	}
		
	
}
}

